#pragma  once

enum StationObjects
{
    ID = 0,
    NAME,
    LINE,
    LATITUDE,
    LONGITUDE,
    UNDEFINED
};

struct Station 
{
    int id;
	double longitude;
	double latitude;
	wchar_t   name[255];
	wchar_t   line[127];

	Station(double lo, double la, const wchar_t* n, const wchar_t* l,int Id = 0)
	{
		longitude = lo;
		latitude = la;
		wcscpy_s(name,255,n);
		wcscpy_s(line,127,l);
        id = Id;
	}

	Station(const Station &station)
	{
		this->latitude = station.latitude;
		this->longitude = station.longitude;
		wcscpy_s(name,sizeof(name),station.name);
		wcscpy_s(name,sizeof(line),station.line);
        this->id = station.id;
	}

	Station& operator=(const Station &station)
	{
		this->latitude = station.latitude;
		this->longitude = station.longitude;
		wcscpy_s(name,255,station.name);
		wcscpy_s(line,127,station.line);
        this->id = station.id;

		return *this;
	}

	bool operator == (const Station& station) const
	{
		return (this->latitude == station.latitude &&
			this->longitude == station.longitude &&
			wcscmp(this->name,station.name) == 0 &&
			wcscmp(this->line,station.line) == 0);
	}

	bool operator == (const Station* station) const
	{
		return (*this == *station);
	}

	bool operator !=(const Station &station) const
	{
		return ! (*this == station);
	}

    CString Get(StationObjects object) const
    {
        CString strObject;
        switch(object)
        {
        case ID:
            strObject.Format(_T("%d"),this->id);
            break;
        case NAME:
            strObject.Format(_T("%s"),this->name);
            break;
        case LINE:
            strObject.Format(_T("%s"),this->line);
            break;
        case LATITUDE:
            strObject.Format(_T("%2.5f"),this->latitude);
            break;
        case LONGITUDE:
            strObject.Format(_T("%2.5f"),this->longitude);
            break;
        default:
            strObject.Format(_T("UNDEFINED STATION OBJECT"));
        }
        return strObject;
    }

	void Set(StationObjects object, const CString& strObject)
	{
		switch(object)
		{
		case ID:
			id = _wtoi(strObject);
			break;
		case NAME:
			wcscpy_s(name,strObject);
			break;
		case LINE:
			wcscpy_s(line,strObject);
			break;
		case LATITUDE:
			latitude = _wtof(strObject);
			break;
		case LONGITUDE:
			longitude = _wtof(strObject);
			break;			
		}
	}
};
